<!--
 * @Author: 淹死De鱼5 happyjing5@sina.cn
 * @Date: 2024-03-16 01:53:16
 * @LastEditors: 淹死De鱼5 happyjing5@sina.cn
 * @LastEditTime: 2024-04-14 01:17:05
 * @FilePath: \vue-ruoyi-drp\src\views\reward\contact\components\check.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!--  -->
<template>
  <el-dialog v-bind="$attrs" title="头像昵称审核" :visible.sync="visibleComputed" width="750px" append-to-body>
    
    <el-form ref="form" :model="form" :rules="rules" label-width="85px">
      
      <el-form-item label="头像:" prop="remark">
        <image-preview :src="form.mbEditContent" :width="40" :height="40"/>
      </el-form-item>
      <el-form-item label="姓名:">
        <!-- <el-input disabled v-model="form.mbEditTitle" placeholder="请输入昵称" /> -->
        <div>{{ form.mbEditTitle }}</div>
      </el-form-item>
      <el-form-item label="状态" prop="mbEditStatus">
        <el-radio-group  v-model="form.mbEditStatus" clearable>
        <el-radio label="0">未审核</el-radio>
        <el-radio label="1">通过</el-radio>
        <el-radio label="-1">拒绝</el-radio>
      </el-radio-group>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="submitForm">确 定</el-button>
      <el-button @click="cancel">取 消</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { getEditInfo, putCheckEdit } from '@/api/center/member'
export default {
  dicts: ['check_task_status'],
  components: {},
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    id: {
      type: String | Number,
      default: ''
    }
  },
  watch: {
    id: {
      handler(val) {
        if (val) {
          this.getInfoHandle(val)
        }
      },
      deep: true,
      immediate: true
      
    }
  },
  data () {
    return {
      form: {},
      // 表单校验
      rules: {
        contactStatus: [
          { required: true, message: "状态不能为空", trigger: "blur" }
        ],
      }
    }
  },
  computed: {
    visibleComputed: {
      get() {
        return this.visible
      },
      set(value) {
        return this.$emit('update:visible', value)
      }
    }
  },
  mounted() {
    
  },
  methods: {
    getInfoHandle(val) {
      getEditInfo(val).then(res => {
        const { data } = res
        this.form = data
      })
    },
    submitForm() {
      if (this.form.mbEditStatus === '0') {
        this.$modal.msgWarning("未选择审核状态");
        return
      }
      const postData = {
        ...this.form
      }
      putCheckEdit(postData).then((result) => {
        this.$modal.msgSuccess("修改成功");
        }).finally(() => {
          this.cancel()
        })
    },
    cancel() {
      this.$emit('update:visible', false)
      this.$emit('cancelHandle')
    }
  }
}
</script>
<style lang='scss' scoped>
</style>
